#!/usr/bin/env python
# LEAVE THE FOLLOWING TWO LINES
# GAME BAKER
# yaml
# 0
s = """
!!python/object:game.Game
gameobjects:
  GameObject1: &id001 !!python/object:game.GameObject
    baseworkstate: Workstate1
    name: GameObject1
    objtype: Gameobject
    requires: []
    sprite: null
    x: 0
    y: 0
  sparkle: !!python/object:game.GameObject
    baseworkstate: ws_sparkle
    name: sparkle
    objtype: Gameobject
    requires: []
    sprite: sparkle
    x: 0
    y: 0
gamescreens:
  None: !!python/object:game.GameScreen
    color: !!python/tuple [23, 5, 107]
    dimensions: !!python/tuple [800, 600]
    objtype: Gamescreen
    startobjects:
    - *id001
initcode: ''
objtype: Game
sprites:
  sparkle: !!python/object:game.Sprite
    alphakey: !!python/tuple [255, 255, 255]
    framerate: 2
    imagefiles:
    - bottomright: !!python/tuple [8, 8]
      filename: sprites/images/sparkle.bmp
      topleft: !!python/tuple [0, 0]
    - bottomright: !!python/tuple [8, 16]
      filename: sprites/images/sparkle.bmp
      topleft: !!python/tuple [0, 8]
    name: sparkle
    objtype: Sprite
startscreen: None
title: Linear Path Demo
workstates:
  Workstate1: !!python/object:game.WorkState
    actions: {1: 'self.path.new_path(style="linear")


        self.resize(3,3)

        self.color=(255,255,255)

        self.clear()


        self.path.add_point(0,0)

        self.path.add_point(300,300)

        self.path.add_point(100,400)

        self.path.add_point(700,550)

        self.path.add_point(500,0)

        self.path.add_point(0,0)


        self.path.set_speed(400)


        self.x = 10

        self.y=10

        self.vars["pathpoint"] = 0.


        self.set_timer(0.2)', 3: 'posn = self.path.follow_path(loop=True)

        ', 11: 'name = "sparkle" + str(int(random.random() * 30))


        a = gamescreen.add_object("sparkle",name )



        a = gamescreen.gameobjects[name]


        a.x = self.x

        a.y = self.y


        self.set_timer(0.08 * random.random())

        '}
    inherits: null
    objtype: Workstate
  ws_sparkle: !!python/object:game.WorkState
    actions: {1: 'self.vx = gamescreen.gameobjects["GameObject1"].vx * 0.85

        self.vy = gamescreen.gameobjects["GameObject1"].vy * 0.85

        self.resize(8,8)

        self.set_timer(random.random() * 1.1)

        pass', 3: '

        self.move_velocity()


        self.vx = self.vx * 0.8

        self.vy = self.vy * 0.8', 11: '

        self.destroy()'}
    inherits: null
    objtype: Workstate

"""
if __name__ == "__main__":
  import gbfileio,sys,runtime
  game = gbfileio.loadgame(sys.argv[0])
  runtime.run_game(game)
